﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ImageProcessing.Utilities;

namespace ImageProcessing
{
    public partial class ResizeDialog : Form
    {
        Dimentions dimentions;
        public ResizeDialog(int width, int height, ref Dimentions dim)
        {
            InitializeComponent();
            originalHeightLbl.Text = height.ToString();
            originalWidthLbl.Text = width.ToString();
            dimentions = dim;
        }

        private void resizebtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.widthtxt.Text != string.Empty && this.heighttxt.Text != string.Empty)
                {
                    dimentions.Width = int.Parse(this.widthtxt.Text);
                    dimentions.Height = int.Parse(this.heighttxt.Text);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please fill in required fields.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw;
            }
        }
    }
}
